<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Index</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      .bg {
        position: absolute;
        right: 0;
        left: 0;
        /* bottom: -100%; */
        top: 0;
        background: url("./18023.jpg") no-repeat;
        background-size: 100%;
      }
      .btn {
        position: absolute;
        /* top: 2.8rem; */
        right: 50%;
        width: 2.8rem;
        line-height: 1rem;
        z-index: 1;
        background: red;
        margin-right: -1.4rem;
      }
    </style>
    <script src="./index.min.js"></script>
  </head>
  <body>
    <p id="kind"></p>
    <img src="./18023.jpg" onload="loadImg()" alt="" />
    <button class="btn">click</button>

    <script>
      function loadImg() {
        setTimeout(() => {
          console.log(document.body.offsetWidth);
        });
      }

      function innerHtml (str) {
        document.body.innerHTML = str
      }

      window.addEventListener("message", (event) => {
        if (event.origin == "http://localhost:8000") {
          const message = event.data || '是是是';
          innerHtml(event.data || '是是是')
          event.source.postMessage(message + "?????", "http://localhost:8000");
        }
      });
    </script>
  </body>
</html>
